import 'package:flutter/material.dart';
import 'package:just_audio/just_audio.dart';
import 'package:wymusic/Util/request.dart';

class Audio extends StatefulWidget {
  Audio(this.id, {Key? key}) : super(key: key);
  final String id;
  void getData(id) {
    // 获取详情
    // Api.getSongs({'id': id}).then((value) {
    //   print(value);
    // });
    // Api.getSongsUrl({'id': id}).then((value) {
    //   print(value);
    // });
  }

  @override
  State<Audio> createState() => _AudioState();
}

class _AudioState extends State<Audio> {
  String title = '123';
  String name = '123';
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    widget.getData(widget.id);
  }

  @override
  Widget build(BuildContext context) {
    final player = AudioPlayer();

    return Padding(
      padding: const EdgeInsets.only(left: 20, right: 20, top: 10, bottom: 10),
      child: Row(children: [
        Padding(
          padding: EdgeInsets.fromLTRB(0, 0, 10, 0),
          child: Image.network(
            'https://vkceyugu.cdn.bspapp.com/VKCEYUGU-479328cb-417a-467c-9512-83793cb72c1e/0e855e47-7b99-4225-85ff-89f516eb4e53.jpg',
            width: 50,
            height: 50,
          ),
        ),
        Column(children: [
          Center(child: Text(title.toString())),
          Center(
            child: Text(name.toString()),
          )
        ]),
        Row(children: [
          IconButton(onPressed: () {}, icon: Icon(Icons.play_arrow_rounded)),
          IconButton(onPressed: () {}, icon: Icon(Icons.skip_next_rounded))
        ]),
      ]),
    );
  }
}
